﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.guide.actions {
    import Engine.Managers.*;

    public class GAWaitForPredicate extends GuideAction {

        protected var m_predicate:Function;
        protected var m_xmldef:XMLList;

        override public function createFromXml(_arg1:XML):Boolean{
            var _local2:XMLList = checkAndGetElement(_arg1, "function");
            if (!_local2){
                return (false);
            };
            this.m_xmldef = _local2;
            this.m_predicate = m_guide.verifyCallback(String(_local2.@name));
            if (this.m_predicate == null){
                ErrorManager.addError(("Tutorial WaitForPredicate got invalid callback: " + _local2.@name));
                return (false);
            };
            return (true);
        }
        override public function update(_arg1:Number):void{
            var _local2:Boolean;
            super.update(_arg1);
            if (this.m_predicate != null){
                _local2 = this.m_predicate(this.m_xmldef);
                if (_local2){
                    removeState(this);
                };
            };
        }

    }
}//package Modules.guide.actions 
